<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			div {
				width: 200px;
				height: 100px;
				margin-top: 5px;
			}

			#d1 {
				background-color: red;
			}

			#d2 {
				background-color: yellow;
			}

			#d3 {
				background-color: blue;
			}

			#d4 {
				background-color: green;
			}

			#d5 {
				background-color: indigo;
			}

			#d0 {
				width: 300px;
				height: 400px;
				border: 1px solid orange;
			}
		</style>
		<script src="js/jquery-3.6.1.js"></script>
	</head>
	<body>
		<script type="text/javascript">
			// window.addEventListener("DOMContentLoaded",function(){})
			$(document).ready(function() {
				//---------------------内部插入-----------------------------------
				const d5 = $("<div id='d5'>5</div>");
				//---------------------被动------------------------------------------
				//后
				// $('#d0').append(d5);
				//前
				// $('#d0').prepend(d5);
				//---------------------主动------------------------------------------
				// d5.appendTo($('#d0'));

				//---------------------外部插入-----------------------------------
				// $('#d0').after(d5);

				//---------------------替换-----------------------------------
				// $('#d4').replaceWith(d5);

				//---------------------克隆-----------------------------------
				// const d11 = $('#d1').clone();
				// $('#d4').replaceWith(d11);
				
				//---------------------删-----------------------------------
				$('#d4').remove();
			});

			/* $(function($) {
			  // 你可以在这里继续使用$作为别名...
			}); */
		</script>
		<div id="d0">
			<div id="d1">1</div>
			<div id="d2">2</div>
			<div id="d3">3</div>
			<div id="d4">4</div>
		</div>
	</body>
</html>
